// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    internal class DeleteBuildStatement : SqlBuildStatement
    {
        public DeleteBuildStatement()
        {
            this.Table = new SqlBuildClause(this.OnChanged);
            this.From = new SqlBuildClause(this.OnChanged);
            this.Join = new SqlBuildClause(this.OnChanged);
            this.Where = new SqlBuildClause(this.OnChanged);
        }

        public override SqlStatementType StatementType => SqlStatementType.Delete;

        public SqlBuildClause Table { get; private set; }

        public SqlBuildClause From { get; private set; }

        public SqlBuildClause Join { get; private set; }

        public SqlBuildClause Where { get; private set; }

        public override SqlBuildStatement Clone()
        {
            var statement = new DeleteBuildStatement();

            statement.Table = statement.Table.Clone(statement.OnChanged);
            statement.From = statement.From.Clone(statement.OnChanged);
            statement.Join = statement.Join.Clone(statement.OnChanged);
            statement.Where = statement.Where.Clone(statement.OnChanged);

            return statement;
        }
    }
}
